home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / setSelectMode.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.9 KB  |  249 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //
  19. //  Alias|Wavefront Script File
  20. //  MODIFY THIS AT YOUR OWN RISK
  21. //
  22. //  Creation Date:  26 June 1997
  23. //  Author:         jb
  24. //
  25. //  Description:
  26. //      This procedure sets the selection mode.
  27. //
  28. //  Input Arguments:
  29. //      A name for the higer level selection mode.
  30. //      A ui name for the mode.
  31. //
  32. //  Return Value:
  33. //        None.
  34. //
  35. // ***********************************************************************
  36. //
  37. // Warning:
  38. //     Be sure that any changes made in this file are also reflected in
  39. //     getSelectMode.mel
  40. //
  41. // ***********************************************************************
  42.  
  43. proc setOnlyMasks( string $masks[]) 
  44. {
  45.     int $i;
  46.     string $cmd;
  47.  
  48.     for ($i = 0; $i < size($masks); $i++) {
  49.         $cmd = "selectType -" + $masks[$i] + " true;";
  50.         eval($cmd);
  51.     }
  52. }
  53.  
  54. global proc setSelectMode( string $mode, string $uiString ) {
  55. //
  56. //    Set the selection masks using a case statement
  57. //
  58.     global string $gAnimationSelectionMasksOn[];
  59.     global string $gNURBSelectionMasksObjects[];
  60.     global string $gNURBSelectionMasksComponents[];
  61.     global string $gDeformersSelectionMasksObjects[];
  62.     global string $gDeformersSelectionMasksComponents[];
  63.     global string $gRenderingSelectionMasksObjects[];
  64.     global string $gRenderingSelectionMasksComponents[];
  65.  
  66.     // When switching from a standard selection mode to a non-standard
  67.     // selection mode, we want to save the selection state (mode, prefs
  68.     // and masks). When we return to a standard selection mode from
  69.     // a non-standard selection mode, we want to restore the selection
  70.     // state.
  71.  
  72.     switch( $mode ) {
  73.  
  74.     // standard selection modes
  75.  
  76.         case "hierarchy":
  77.             selectionMaskRestoreOnce();
  78.             selectMode -hierarchical;
  79.             break;
  80.         case "root":
  81.             selectionMaskRestoreOnce();
  82.             selectMode -root;
  83.             break;
  84.         case "leaf":
  85.             selectionMaskRestoreOnce();
  86.             selectMode -leaf;
  87.             break;
  88.         case "template":
  89.             selectionMaskRestoreOnce();
  90.             selectMode -template;
  91.             break;
  92.  
  93.         case "objects":
  94.             selectionMaskRestoreOnce();
  95.             selectMode -object;
  96.             break;
  97.  
  98.         case "components":
  99.             selectionMaskRestoreOnce();
  100.             selectMode -component;
  101.             break;
  102.  
  103.     // custom selection modes
  104.  
  105.         case "animation":
  106.             selectionMaskSaveOnce();
  107.             selectMode -object;
  108.             selectPriority -allObjects 1;
  109.             selectPref -ignoreSelectionPriority false;
  110.             selectPriority
  111.                 -handle 5
  112.                 -ikHandle 5
  113.                 -joint 4;
  114.             selectType -allObjects false -allComponents false;
  115.             setOnlyMasks($gAnimationSelectionMasksOn);
  116.             break;
  117.         case "nurbsModeling":
  118.             selectionMaskSaveOnce();
  119.             selectMode -preset;
  120.             selectPref -ignoreSelectionPriority false;
  121.             selectPref -allowHiliteSelection false;
  122.             selectPriority -allComponents 1;
  123.             selectPriority -isoparm 2;
  124.  
  125.             selectType -allObjects false -allComponents false;
  126.             setOnlyMasks($gNURBSelectionMasksObjects);
  127.             setOnlyMasks($gNURBSelectionMasksComponents);
  128.  
  129.             break;
  130.         case "polyModeling":
  131.             selectionMaskSaveOnce();
  132.             selectMode -component;
  133.             selectType -allObjects false -allComponents false;
  134.             selectPref -ignoreSelectionPriority true;
  135.             selectPref -allowHiliteSelection true;
  136.             selectType
  137.                 -polymesh true
  138.                 -subdiv true
  139.                 -plane true
  140.                 -facet true;
  141.             break;
  142.         case "deformations":
  143.             selectionMaskSaveOnce();
  144.             selectMode -preset;
  145.             selectPref -ignoreSelectionPriority false;
  146.             selectPref -allowHiliteSelection false;
  147.             selectPriority -allObjects 1 -allComponents 1;
  148.             selectPriority
  149.                 -sculpt 5
  150.                 -nonlinear 5                
  151.                 -lattice 5
  152.                 -cluster 5
  153.                 -locator 5;
  154.             selectType -allObjects false -allComponents false;
  155.             setOnlyMasks($gDeformersSelectionMasksObjects);
  156.             setOnlyMasks($gDeformersSelectionMasksComponents);
  157.             break;
  158.         case "dynamics":
  159.             selectionMaskSaveOnce();
  160.             selectMode -preset;
  161.             selectType -allObjects false -allComponents false;
  162.             selectType
  163.                 -particleShape true
  164.                 -emitter true
  165.                 -field true
  166.                 -fluid true
  167.                 -collisionModel true
  168.                 -spring true
  169.                 -rigidBody true
  170.                 -rigidConstraint true
  171.                 -particle true
  172.                 -springComponent true;
  173.             selectPref -allowHiliteSelection true;
  174.             break;
  175.         case "rendering":
  176.             selectionMaskSaveOnce();
  177.             selectMode -preset;
  178.             selectType -allObjects false -allComponents false;
  179.             setOnlyMasks($gRenderingSelectionMasksObjects);
  180.             setOnlyMasks($gRenderingSelectionMasksComponents);
  181.             selectPref -allowHiliteSelection false;
  182.             break;
  183.         case "vertices":
  184.             selectionMaskSaveOnce();
  185.             selectMode -component;
  186.             selectType -allObjects false -allComponents false;
  187.             selectType
  188.                 -controlVertex true
  189.                 -subdivMeshPoint true
  190.                 -vertex true
  191.                 -latticePoint true
  192.                 -particle true;
  193.             break;
  194.         case "hulls":
  195.             selectionMaskSaveOnce();
  196.             selectMode -component;
  197.             selectType -allObjects false -allComponents false;
  198.             selectType
  199.                 -hull true;
  200.             break;
  201.         case "lines":
  202.             selectionMaskSaveOnce();
  203.             selectMode -component;
  204.             selectType -allObjects false -allComponents false;
  205.             selectType
  206.                 -isoparm true
  207.                 -polymeshEdge true
  208.                 -subdivMeshEdge true
  209.                 -surfaceEdge true
  210.                 -springComponent true;
  211.             break;
  212.         case "points":
  213.             selectionMaskSaveOnce();
  214.             selectMode -component;
  215.             selectType -allObjects false -allComponents false;
  216.             selectType
  217.                 -editPoint true
  218.                 -curveParameterPoint true
  219.                 -surfaceParameterPoint true
  220.                 -polymeshUV true
  221.                 -subdivMeshUV true;
  222.             break;
  223.  
  224.         case "allComponents":
  225.             selectionMaskRestoreOnce();
  226.             selectionMaskSaveOnce();
  227.             selectMode -component;
  228.             selectType -allObjects false -allComponents true;
  229.             break;
  230.         case "allObjects":
  231.             selectionMaskRestoreOnce();
  232.             selectionMaskSaveOnce();
  233.             selectMode -object;
  234.             selectType -allObjects true -allComponents false;
  235.             selectPref -ignoreSelectionPriority true;
  236.             break;
  237.  
  238.         default:
  239.             selectionMaskRestoreOnce();
  240.             selectMode -object;
  241.             selectType -allObjects true -allComponents false;
  242.             selectPref -ignoreSelectionPriority false;
  243.             break;
  244.     }
  245.     if ($uiString != "") {
  246.         textField -e -tx $uiString maskField;
  247.     }
  248. }
  249.